<%@ page language="java" pageEncoding="UTF-8"
import="cn.edu.hbwe.book.entity.Notice"
    import="java.util.ArrayList"
	import="java.util.List"
%>

<HTML>
<HEAD>
	<meta http-equiv="Content-Language" content="zh-cn">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link href="${pageContext.request.contextPath}/admin/css/notlist.css"
		rel="stylesheet" type="text/css" />

	<script >
		function addlist() {
			window.location.href = "${pageContext.request.contextPath}/admin/notices/add.jsp";
		}
	</script>
</HEAD>
<body>
	<br />
	<form id="Form1" name="Form1" action="" method="post">
		<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
			<tbody>
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3">
					    <strong>公 告 列 表</strong>
					</td>
				</tr>
				<tr>
					<td class="ta_01" align="right">
						<button type="button" id="add" name="add" value="&#28155;&#21152;" class="button_add" onclick="addlist()">
							添加公告
						</button>
					</td>
				</tr>
				<tr>
					<td class="ta_01" align="center" bgColor="#f5fafe">
						<table  border="1" id="DataGrid1"
							style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
							<tr
								style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">
								<td align="center" width="12%">公告编号</td>
								<td align="center" width="12%">公告标题</td>
								<td align="center" width="24%">公告内容</td>
								<td align="center" width="8%">时间</td>
								<td width="8%" align="center">编辑</td>
								<td width="8%" align="center">删除</td>
							</tr>
							  <!--  循环输出所有商品 -->
                            <% 
			
                            if(request.getAttribute("notices")!=null){
               				 ArrayList<Notice> notices = (ArrayList)request.getAttribute("notices"); 
				int len = notices.size();
				
			for(int i=0;i<len;i++){	
			%>		
								<tr onmouseover="this.style.backgroundColor = 'white'" onmouseout="this.style.backgroundColor = '#F5FAFE';">
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="23"><%=notices.get(i).getN_id()%></td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="18%"><%=notices.get(i).getTitle()%></td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="8%"><%=notices.get(i).getDetails()%></td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="8%"><%=notices.get(i).getN_time()%></td>
									<td align="center" style="HEIGHT: 22px" width="7%">
										<a href="${pageContext.request.contextPath}/FindByIdNoticeServlet?id=<%=notices.get(i).getN_id()%>">
											<img src="${pageContext.request.contextPath}/admin/images/i_edit.gif" border="0" style="CURSOR: hand"> 
										</a>
									</td>
									<td align="center" style="HEIGHT: 22px" width="7%">
										<a href="${pageContext.request.contextPath}/DeleteNoticeServlet?id=<%=notices.get(i).getN_id()%>">
											<img src="${pageContext.request.contextPath}/admin/images/i_del.gif" width="20" height="20" border="0" onclick="sure_delete()"style="CURSOR: hand">
										
										<script type="text/javascript">
										function sure_delete(){
											if(!confirm("确认要删除？")){
												window.event.returnValue = false;
												}
										}
        </script>
        </a>
									</td>
								</tr>
								   <%}} %>
							
						</table>
					</td>
				</tr>
			</TBODY>
		</table>
	</form>
</body>
</HTML>